package com.qfjy.homework.bianjiahua;

/** 执行者类
 *      能存储状态信息到备忘录
 *      能从备忘录中获取状态信息
 * @author bjh
 * @version 1.0
 * @date 2023/4/1 16:16
 */
public class ExecutMan {

    private String status;//定义私有状态属性

    //生成get()/set()
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * 存储状态信息到备忘录
     * @return
     */
    public Memorandum saveStatusToMemorandum() {
        return new Memorandum(status);
    }

    /**
     * 从备忘录中获取状态信息,并将状态回溯到获取的版本
     * @param memorandum
     */
    public void getStatusFromMemorandum(Memorandum memorandum) {
        status = memorandum.getStatus();
    }

}
